//    Copyright (C) Kherty.  All rights reserved.
using OpenLS.Core.Serialization;

namespace OpenLS.Drawing
{
    using AdjCoordinate = System.String;

    internal class GeometryRectangle : IOfficeXmlSerializable
    {
        private AdjCoordinate b;
        private string l;

        private AdjCoordinate r;

        private AdjCoordinate t;

        public AdjCoordinate Left
        {
            get { return l; }
            set { l = value; }
        }

        public AdjCoordinate Right
        {
            get { return r; }
            set { r = value; }
        }

        public AdjCoordinate Top
        {
            get { return t; }
            set { t = value; }
        }

        public AdjCoordinate Bottom
        {
            get { return b; }
            set { b = value; }
        }

        #region IOfficeXmlSerializable Members

        void IOfficeXmlSerializable.ReadXml(ReadContext context)
        {
            using (var c = context.Read("rect"))
            {
                Left = c.GetString("l");
                Right = c.GetString("r");
                Top = c.GetString("t");
                Bottom = c.GetString("b");
            }
        }

        void IOfficeXmlSerializable.WriteXml(WriteContext context)
        {
            using (WriteContext c = context.Write("rect"))
            {
                c.SetString("l", Left);
                c.SetString("r", Right);
                c.SetString("t", Top);
                c.SetString("b", Bottom);
            }
        }

        #endregion
    }
}